|
|
|
|
|
|
|
When declaring an instance variable of a user-defined type, add a prefix to the variable name to reference the type: |
|
|
|
 |
|
|
|
|
Dim typCust as typCustomer |
|
|
|
|
|
|
|
|
When creating your own user-defined classes, you need to be aware of who your target user will be for that class. If youll be exposing that object and its properties through an Automation Server, you should not use Hungarian notation. Nonprogrammer types will not understand this type of notation. |
|
|
|
|
|
|
|
|
Its recommended that you create Property Get/Let/Set procedures for every variable used within the class you want to give the user access to. Use Hungarian notation on all private data but do not use it on the Property Get/Let/Set procedures. |
|
|
|
|
|
|
|
|
When naming your class modules, keep in mind that you need to give each public class a descriptive name that the user can understand. If youre creating an internal class thats only used within your program, use the prefix cls or maybe just C (see Table A.8). |
|
|
|
|
| Table A.8 Prefixes for Class Modules. | | Prefix | Description | | cls or C | Only used for private classes | | (none) | For any public classes that will be exposed through an OLE Server |
|
|
|
|
|
|
Constant names should use uppercase letters with an underscore (_) between the words. This will help distinguish your constants from the built-in constants in VBA. Also, be sure to always type your constants. If you do not type your constants, they will be of the type Variant. This means youre using up 16 bytes per constant. This is a big waste and should be avoided. Here are some examples of constant declarations: |
|
|
|
 |
|
|
|
|
PublicConst TAB_ADDRESS As Integer = 0
Public Const TAB_PHONES As Integer = 1 |
|
|
|
|
|